import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/selectmain',
    name: '下拉框',
    component: () => import('../components/celectTest/SelectMain'),
  },
  {
    path: '/container',
    name: 'container',
    component: () => import('../views/Container.vue'),
  },
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('../views/AboutView.vue')
  },
  {
    path: '/nav',
    name: 'nav',
    component: () => import('../views/Nav.vue'),
  },
  ,
  {
    path: '/component',
    name: 'Component',
    component: () => import('../views/Component.vue'),
    // 路由重定向 当访问comp自动跳转
    redirect:'/component/container',

    children:[{
      path:'container',
      component:()=>import('../views/Container.vue')
    },
    {
      path:'table',
      component:()=>import('../views/Table.vue')
    },
    {
      path:'form',
      component:()=>import('../views/Form.vue')
    }
  ]
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
